package com.token.iot.bratterycharging.gateway.business.facade;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.outstanding.framework.core.PendingException;
import com.token.iot.bratterycharging.gateway.Sender;
import com.token.iot.bratterycharging.gateway.api.BusinessFacade;
import com.token.iot.bratterycharging.gateway.api.ConsumptionAmount;
import com.token.iot.bratterycharging.gateway.api.DeviceParam;
import com.token.iot.bratterycharging.gateway.api.DeviceState;
import com.token.iot.bratterycharging.gateway.api.Fee;
import com.token.iot.bratterycharging.gateway.api.Port;
import com.token.iot.bratterycharging.gateway.api.PowersFee;
import com.token.iot.bratterycharging.gateway.business.service.BratteryChargingService;

public class BusinessFacadeImpl implements BusinessFacade {

	@Autowired
	private BratteryChargingService service;

	//@Override
	public boolean remotePower(String imei, boolean flag) throws PendingException {
		return service.remotePower(imei, flag);

	}

	@Override
	public int charge(String imei,int index,int fenzhong) throws PendingException {
		return service.charge(imei,index,fenzhong);
	}

	
	@Override
	public List<Port> getPortInfo(String imei) throws PendingException {
		return service.getPortInfo(imei);
	}
	
	
	//@Override
	public String getMainboard(String imei) throws PendingException{
		return service.getMainboard(imei);
		
	}
	
	
	@Override
	public Boolean setDeviceParams(String imei,int money, int first,int second,int third) throws PendingException{
		return service.setDeviceParams(imei, money, first, second, third);
	}
	
	@Override
	public DeviceParam getDeviceParams(String imei) throws PendingException{
		return service.getDeviceParams(imei);
	}
	
	/**
	 * 设置5档功率和计费率
	 */
	@Override
	public Boolean setPowerRatio(String imei,PowersFee pf)  throws PendingException{
		return service.setPowerRatio(imei, pf);
	}
	
	@Override
	public Boolean setDevicePartEnable(String imei,boolean cardFlag,boolean coinFlag) throws PendingException{
		return service.setDevicePartEnable(imei, cardFlag, coinFlag);
	}
	
	@Override
	public Boolean setDevicePort(String imei,int index, boolean flag) throws PendingException{
		return service.setDevicePort(imei, index, flag);
	}
	
	
	@Override
	public Port stopCharge(String imei,int index)  throws PendingException{
		return service.stopCharge(imei, index);
	}
	
	
	/**
	 * 查询设备端口的充电状态
	 * @param imei
	 * @param index
	 * @return
	 * @throws PendingException
	 */
	@Override
	public Port getPortChargeState(String imei,int index)  throws PendingException{
		return service.getPortChargeState(imei, index);
	}
	
	/**
	 *  获取整机的充电状态
	 * @param imei
	 * @return
	 * @throws PendingException
	 */
	@Override
	public DeviceState getDeviceChargeState(String imei)  throws PendingException{
		return service.getDeviceChargeState(imei);
	}
	
	
	/**
	 * 获取设备的消费总额
	 * @param imei
	 * @return
	 * @throws PendingException
	 */
	@Override
	public ConsumptionAmount getConsumptionAmount(String imei)  throws PendingException{
		return service.getConsumptionAmount(imei);
	}
	
	
	/**
	 * 设置充满后的策略
	 * @param imei
	 * @param autoFlag 充满自停标志 :true 为自停，false为不自停
	 * @param cardFlag 刷卡退费标志：true 为退费，false为不退费
	 * @return
	 * @throws PendingException
	 */
	@Override
	public Boolean setChargedPolicy(String imei,boolean autoFlag,boolean cardFlag)  throws PendingException{
		return service.setChargedPolicy(imei, autoFlag, cardFlag);
	}
	
	/**
	 * 读取设备5档功率和费率
	 * @param imei
	 * @return
	 * @throws PendingException
	 */
	@Override
	public PowersFee getPowerRatio(String imei)  throws PendingException{
		return service.getPowerRatio(imei);
	}
	
	/**
	 * 获取硬件版本号
	 * 
	 */
	@Override
	public String getDeviceVersion(String imei) throws PendingException{
		return service.getDeviceVersion(imei);
	}

	
	
	
}
